home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / Pedestal / Source / Sources / Menus / PedMenuApple.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  1013 b   |  74 lines

  1. /*    ===============
  2.  *    PedMenuApple.cc
  3.  *    ===============
  4.  */
  5.  
  6. #include "PedestalDebugging.h"
  7.  
  8. #include <Devices.h>
  9.  
  10. #include "PedMenuApple.hh"
  11. #include "PedCommand.hh"
  12.  
  13. enum {
  14.     idAppleMENU = 128, // menu ID = 1
  15.     idFileMENU,
  16.     idEditMENU
  17. };
  18.  
  19.  
  20. PedMenuApple::PedMenuApple()
  21. : mAboutCmd(NULL)
  22. {
  23.     GetFromResource(idAppleMENU);
  24.     AppendAppleMenuItems();
  25. }
  26.  
  27. void
  28. PedMenuApple::AppendAppleMenuItems()
  29. {
  30.     ::AppendResMenu(macMenu, 'DRVR');
  31. }
  32.  
  33. void
  34. PedMenuApple::InstallCommand(PedCommand *inCmd, CmdCode inCode)
  35. {
  36.     switch (inCode) {
  37.         case 'abou':
  38.             mAboutCmd = inCmd;
  39.             break;
  40.         default:
  41.             break;
  42.     }
  43. }
  44.  
  45. void
  46. PedMenuApple::DoMenuItem(short inItem)
  47. {
  48.     PedCommand *cmd;
  49.     
  50.     switch (inItem) {
  51.         case 1:
  52.             cmd = mAboutCmd;
  53.             break;
  54.         default:
  55.             cmd = NULL;
  56.             DoAppleMenuItem(inItem);
  57.             break;
  58.     }
  59.     if (cmd)
  60.         cmd->Execute();
  61. }
  62.  
  63. void
  64. PedMenuApple::DoAppleMenuItem(short inItem)
  65. {
  66.     GrafPtr savePort;
  67.     Str255 itemName;
  68.     
  69.     GetItemText(inItem, itemName);
  70.     ::GetPort(&savePort);
  71.     ::OpenDeskAcc(itemName);
  72.     ::SetPort(savePort);
  73. }
  74.